package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.javaBean.ShakeRedBean
import fhp.hlhj.giantfold.javaBean.ShakeRedListBean
import fhp.hlhj.giantfold.network.UrlApis

/**
 * Created by Administrator on 2018\2\5 0005.
 */
class ShakeRedModule {
    interface onShakeListener{
        fun showLoading()
        fun onResp(shakeRedBean: ShakeRedBean)
        fun onListResp(shakeRedListBean: ShakeRedListBean)
    }

    fun shakeRed(params: HttpParams,listener: onShakeListener){
        UrlApis.shakeRed(params)
                .doOnSubscribe {
                    listener.showLoading()
                }
                .subscribe({
                    data->
                    listener.onResp(data)

                })
    }

    fun shakeRedList(params: HttpParams,listener: onShakeListener){
        UrlApis.shakeRedList(params)
                .doOnSubscribe {

                }
                .subscribe {
                    data->
                    listener.onListResp(data)
                }
    }
}